package com.wxlsoft.config;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

import javax.swing.JProgressBar;

import com.wxlsoft.config.deploy.EsbPlatform;
import com.wxlsoft.excel.core.RunHandler;
import com.wxlsoft.excel.enums.HandlerConfigType;
import com.wxlsoft.ui.OkOnPressListener.ActionRunnable;
import com.wxlsoft.utils.LogUtils;

/**
 * 配置中心导入实例
 * @author wangxiaoliang
 */
public class ConfigImportHandler extends RunHandler implements ActionListener {

	private ExecutorService pool = Executors.newFixedThreadPool(1);
	
	public ConfigImportHandler(JProgressBar progressBar1, String filePath, HandlerConfigType ccType) {
		super(new ConfigProcessor(ccType), progressBar1, filePath);
	}

	@Override
	public void run() throws Exception {
		LogUtils.clean();
		LogUtils.info("Copyright © 2023 - 2053 Dcits. All Rights Reserved");
		LogUtils.info("Dcits Config Publish Client");
		LogUtils.info("神州数码云解决交付三部");
		processor.execute();
		LogUtils.info("Dcits Config Publish Success");
	}

	@Override
	public void actionPerformed(ActionEvent e) {
		pool.execute(new ActionRunnable(this));
	}

	public EsbPlatform getPlatform() {
		return ((ConfigProcessor) processor).getPlatform();
	}
	
}
